@extends('layout.adminlayout')
@section('css')
<script src="/admin/js/metisMenu.min.js"></script>
<script src="/admin/js/custom.js"></script>
<link href="/admin/css/custom.css" rel="stylesheet">

{{--时间范围--}}
<link rel="stylesheet" href="/layui/css/layui.css"  media="all">
<script src="/layui/layui.js" charset="utf-8"></script>
{{--时间范围--}}

@endsection
@section('content')
<div class="tables">
	<div class="table-responsive bs-example widget-shadow">
		<h4>日志管理 :</h4>
		<form action="/admin/device/log" method="get">
			<div class="row" style="padding-bottom: 15px;margin-top: 0px;">
				<div class="layui-form-pane" style="margin-top: 15px;">
					<div class="layui-form-item">
						<label class="layui-form-label">DevEUI</label>
						<div class="layui-input-inline">
							<input type="text" name="eui" value="{{$get['eui']}}" class="layui-input"/>
						</div>
						<label class="layui-form-label">时间</label>
						<div class="layui-input-inline">
							<input class="layui-input" placeholder="开始日" id="LAY_demorange_s" name="start" value="{{date('Y-m-d H:i:s',$get['start'])}}">
						</div>
						<div class="layui-input-inline">
							<input class="layui-input" placeholder="截止日" id="LAY_demorange_e" name="end" value="{{date('Y-m-d H:i:s',$get['end'])}}">
						</div>
						<div class="layui-input-inline">
							<input type="submit" class="layui-input" style="padding: 0px; border: 0; background: #4F52BA;width: 50px; margin: 0px 10px;color:#fff" >
						</div>
					</div>
				</div>
			</div>
		</form>
		<div id="box">
			<table class="table table-bordered">
				<thead>		
	 				<tr>
						<th>numbers</th>
						<th>Gateway Time</th>
						<th>DevEUI</th>
						<th>Gateway ID</th>
						<th>Channel</th>
						<th>Frequency(MHz)</th>
						<th>DataRate</th>
						<th>RSSI</th>
						<th>SNR</th>
						<th>FCntUp</th>
						<th>FPort</th>
						<th>Data</th>
					</tr>
				</thead>
				<tbody>
				@if(!null==$data)
					@foreach($data as $k => $v)
						<tr> 
							<th scope="row">{{++$k}}</th> 
							<td>{{date('Y-m-d H:i:s',$v['LaTime'])}}</td>
							<td>{{$v['DevEUI']}}</td>
							<td>{{$v['GatewayID']}}</td>
							<td>{{$v['Channel']}}</td>
							<td>{{$v['Frequency']}}</td>
							<td>{{$v['DataRate']}}</td>
							<td>{{$v['RSSI']}}</td>
							<td>{{$v['SNR']}}</td>
							<td>{{$v['FCntUp']}}</td>
							<td>{{$v['FPort']}}</td>
							<td>{{$v['Data']}}</td>
						</tr>
					@endforeach
				@endif
				</tbody> 
			</table>
		</div>
        @if(!null == $data)
        	<div style="float:right;">
        	{!! $data->appends($request)->render() !!}
        	</div>
        @endif
	</div>
</div>
@endsection
@section('lastjs')
<script src="http://cdn.bootcss.com/socket.io/1.3.7/socket.io.js"></script>
<script src="/admin/js/debugLog.js"></script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        var start = {
            min: '2000-06-16 23:59:59'
            ,max: laydate.now()
            ,istoday: false
            ,choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };

        var end = {
            min: '2000-06-16 23:59:59'
            ,max: laydate.now()
            ,istoday: false
            ,choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };

        document.getElementById('LAY_demorange_s').onclick = function(){
            start.elem = this;
            laydate(start);
        }
        document.getElementById('LAY_demorange_e').onclick = function(){
            end.elem = this
            laydate(end);
        }

    });
</script>
@endsection